<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');?>
<div id="closeParentTime" style="display:none"></div>

<div class="pad-10">
<div class="content-menu ib-a blue line-x">
<a class="add fb" target="**admim.create.8**" href="?m=content&c=content&a=add&menuid=&catid=<?=$catid;?>&p_catid=<?=$p_catid;?>&p_id=<?=$p_id;?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>"><em>添加</em></a>
<?php echo $workflow_menu;?>
<?php if($category['ishtml']) {?>
<span>|</span><a href="?m=content&c=create_html&a=category&pagesize=30&dosubmit=1&modelid=0&catids[0]=<?php echo $catid;?>&pc_hash=<?php echo $pc_hash;?>&referer=<?php echo urlencode($_SERVER['QUERY_STRING']);?>"><em><?php echo L('update_htmls',array('catname'=>$category['catname']));?></em></a>
<?php }?>
</div>
<div id="searchid">
<form name="searchform" action="" method="get" >
<input type="hidden" value="content" name="m">
<input type="hidden" value="lesson" name="c">
<input type="hidden" value="init" name="a">
<input type="hidden" value="<?php echo $catid;?>" name="catid">
<input type="hidden" value="<?php echo $steps;?>" name="steps">
<input type="hidden" value="1" name="search">
<input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash">
<table width="100%" cellspacing="0" class="search-form">
	<tr> <td> <div class="explain-col">
	关键字: <input type="text" class="input-text" name="keyword" value="<?php if(isset($keyword)) echo $keyword;?>">
	<select name="p_catid">
		<option value='1' <?php if($_GET['p_catid']==1) echo 'selected';?>>精选课堂</option>
		<option value='2' <?php if($_GET['p_catid']==2) echo 'selected';?>>在线课堂</option>
	</select>
	<input type="text" class="input-text" name="p_id" value="<?php echo $_GET['p_id']?>">
	<input type="submit" name="search" class="button" value="搜索">
	</div> </td> </tr>
</table>
</form>
</div>
<form name="myform" id="myform" action="" method="post" >
<div class="table-list">
<table width="100%">
	<thead>
		<tr>
		 <th width="16"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th>
		<th width="37"><?php echo L('listorder');?></th>
		<th width="40">ID</th>
		<th><?php echo L('title');?></th>
		<th width="70"><?php echo L('publish_user');?></th>
		<th width="118"><?php echo L('updatetime');?></th>
		<th width="72"><?php echo L('operations_manage');?></th>
		</tr>
	</thead>
<tbody>
<?php
if(is_array($datas)) {
	$sitelist = getcache('sitelist','commons');
	$release_siteurl = $sitelist[$category['siteid']]['url'];
	$path_len = -strlen(WEB_PATH);
	$release_siteurl = substr($release_siteurl,0,$path_len);
	$this->hits_db = pc_base::load_model('hits_model');
	
	foreach ($datas as $r) {
		$hits_r = $this->hits_db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r['id']));
?>
	<tr>
	<td align="center"><input class="inputcheckbox " name="ids[]" value="<?php echo $r['id'];?>" type="checkbox"></td>
	<td align='center'><input name='listorders[<?php echo $r['id'];?>]' type='text' size='3' value='<?php echo $r['listorder'];?>' class='input-text-c'></td>
	<td align='center' ><?php echo $r['id'];?></td>
	<td><?php echo '<a href="'.$r['url'].'" target="_blank">';?><span<?php echo title_style($r['style'])?>><?php echo $r['title'];?></span></a> <?php if($r['thumb']!='') {echo '<img src="'.IMG_PATH.'icon/small_img.gif" title="'.L('thumb').'">'; } ?></td>
	<td align='center'><?=$r['username']?></td>
	<td align='center'><?php echo format::date($r['updatetime'],1);?></td>
	<td align='center'><a target="admin.edit.8" href="?m=content&c=content&a=edit&catid=<?php echo $catid;?>&id=<?php echo $r['id']?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>">修改</a></td>
</tr>
 <?php }
}
?>
</tbody>
	 </table>
	<div class="btn"><label for="check_box"><?php echo L('selected_all');?>/<?php echo L('cancel');?></label>
		<input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash">
		<input type="button" class="button" value="排序" onclick="myform.action='?m=content&c=content&a=listorder&dosubmit=1&catid=<?php echo $catid;?>&steps=<?php echo $steps;?>';myform.submit();"/>
		<input type="button" class="button" value="删除" onclick="myform.action='?m=content&c=content&a=delete&dosubmit=1&catid=<?php echo $catid;?>&steps=<?php echo $steps;?>';return confirm_delete()"/>
	</div>
	<div id="pages"><?php echo $pages;?></div>
</div>
</form>
</div>
<script type="text/javascript" src="<?php echo JS_PATH?>cookie.js"></script>
<script type="text/javascript">
function confirm_delete(){
	if(confirm('<?php echo L('confirm_delete', array('message' => L('selected')));?>')) $('#myform').submit();
}
setcookie('refersh_time', 0);
function refersh_window() {
	var refersh_time = getcookie('refersh_time');
	if(refersh_time==1) {
		window.location.reload();
	}
}
setInterval("refersh_window()", 3000);
</script>
</body>
</html>